home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
disk
/
cache
/
cacheclock.lha
/
CacheClock.doc
< prev
Wrap
Text File
|
1993-05-31
|
7KB
|
191 lines
CacheClock
Floppy disk cache, free memory and time indicator
Version 1.1
Copyright (c) 1993 Justin Leck
16th April 1993
Introduction
------------
CacheClock came about because I had two different programs running in the
background (clock and memory indicator), and AddBuffers was eating away a
lot of my Chip memory. It performs three functions :
1) To display the amount of free memory available (both chip and fast)
2) To display the current time onscreen
3) To cache disk accesses, so cutting down the wear and tear on the drives.
The first two speak for themselves, just run the program to see them in
action. The disk caching remembers a number of disk sectors, and stores them
in RAM. Any subsequent trackdisk requests to read this sector will result in
the sector being copied from ram, without engaging the disk drives.
What this means is that if you type DIR, then the drive will grunt and
complain a great deal until the directory has been read in. Type DIR again,
and the drive will remain quiet, but the directory will be displayed. What
has happened is that on the first DIR, the sectors have been copied to
memory, and on the second DIR, the sectors are read from memory instead of
disk. This is much quieter, and also quicker.
Why not use AddBuffers ?
1) AddBuffers only remembers whole disk tracks
2) AddBuffers holds the buffers in Chip Ram
3) AddBuffers allocates buffers to a specific drive
CacheClock remembers disk sectors on a sector by sector basis, and
stores this in public memory. CacheClock allocates the buffers to various
drives as the need arises.
CacheClock consists of two windows, an expanded statistical display, and a
shrunken window, displaying the free memory and time. To toggle between the
two modes, select the CacheClock window, and press the right mouse button.
The Large window looks something like:
|----------||--------------------------||-------|
| Drive || A B C D || Total |
|----------||--------------------------||-------|
| Reads || 0 0 0 0 || 0 |
| Writes || 0 0 0 0 || 0 |
| ReadHits|| 0 0 0 0 || 0 |
|Percentage|| || |
| Buffers || 0 0 0 0 || 0 |
|----------||--------------------------||-------|
---------- ---------------------------- --------
| Fewer | |Free:2345592 Time:20:00:45| | More |
---------- ---------------------------- --------
Disk A is the first drive used since CacheClock was installed, Disk B is the
second, and so on. I may change this to DF0:, DF1: etc later.
The Reads/Writes fields indicate the number of sector reads or writes to the
specific drives.
The ReadHits field shows how many disk sector reads have been copied from
the cache instead of read in from disk.
The Buffers field shows how many disk sectors have been remembered for a
certain drive. The Total number of sectors shows the maximum number of disk
sectors which can be remembered.
The Fewer and More buttons free / allocate memory for use as disk buffers
in the disk cache.
Running CacheClock
------------------
From Workbench:
Double click on the CacheClock icon
You'll have to supply your own icon, and there are no options available
From the CLI:
Type :
CacheClock [-<options>]
A brief list of options can be produced by typing "CacheClock ?". These are
as follows:
-b number Default number of buffers
The number selects the maximum number of disk sectors
which can be remembered by the program
-l Large window
Starts CacheClock up showing the information window
-x number Default X co-ordinate
-y number Default Y co-ordinate
These options can force the CacheClock window to be
opened at any place on screen. If the window would
be placed offscreen, then no window is opened, and
the program quits.
The default settings are:
256 buffers, small window, place window at top of screen, just to the left of
the window depth gadgets on kickstart 1.3
E.g.
CacheClock -lb500 -x0 -y0
This will open the information screen, give CacheClock 500 buffers to use,
and place the opened window at screen position (0,0)
CacheClock can only be run once. If you attempt to run CacheClock again,
the program will just quit, leaving the original still running.
CacheClock detatches itself from the CLI, so there is no need to RUN it.
Running CacheClock with other Programs
--------------------------------------
Since CacheClock patches the trackdisk.device routines, some virus killers
may alert you that a virus is in memory. If you believe you may have been
infected, try the virus killer without CacheClock running. CacheClock only
alters the trackdisk base address.
Don't run CacheClock when fixing disks with fixdisk, or any other program
which takes over the trackdisk handler, such as disk copiers. If you do, then
do so at your own risk, and upon exiting the software, eject all disks from
all your drives, to reset the disk caches.
Be careful when using CacheClock and the Action Replay Cartridge or other
similar hardware devices, since if you save a file from within the cartridge,
and then exit, the file may not show up in the directory. To remedy this,
eject the disk and then exit from the cartridge. This will reset the disk
cache.
Technical Information
---------------------
The caching routine works by intercepting trackdisk.device (legally), and
remembering all the sectors read in or written out to disk. If an attempt is
made to read in a sector which has already been read in, then no disk IO is
performed, and the sector is copied from memory. Disk writes are just
remembered, nothing else.
Buffers are allocated from the unused buffer list, until no more are
available. When this happens, the disk sector which was used last is used.
Ejecting a disk causes all the cached sectors for that disk to be added to
the free list.
The display is updated every second, with only changes to the display being
redrawn.
History
-------
Version 1.1 - CacheClock now detaches itself from the CLI, no need to
RUN it anymore
- Bug fixed which caused a crash when called from workbench
Version 1.0 - First release
Other Useful Information
------------------------
This program is public domain, and you can do what you want with it (copy
it, archive it, delete it, etc), just so long as this document accompanies
it. (Powerpacker it if you want)
CacheClock was written using Lecasm, and the source code will be
distributed with the Lecasm macro assembler whenever I complete it. Lecasm
is a one pass assembler, twice as quick as Devpac 2, combined editor and
assembler and will probably be available as Shareware in the near future.
The program was crunched using LeCrunch, my compression utility which will
be available as Shareware shortly. This is CLI based, very short, and
crunches faster and more efficiently than Imploder, and better than
powerpacker on larger files (demos especially so).
If you have any comments, then contact me at the following address:
Justin Leck
26 Fountains Close
Whitby
North Yorkshire
YO21 1JS
England